package com.hexun.busi.base.common.enums;

/**
 * @author zhoudong
 * @version 0.1
 * @date 2018/4/23 17:54
 */
public enum StartTypeEnum {
    INIT("0","INIT","初始化"),
    PROCESS("1","PROCESS", "助力中"),
    CANCEL("2", "CANCEL","取消"),
    EXPIRED("3", "EXPIRED","过期");

    private final String   code;
    private final String   insCode;
    private final String message;

    StartTypeEnum(String   insCode, String code, String message) {
        this.code = code;
        this.insCode = insCode;
        this.message = message;
    }

    /**
     * 通过代码获取枚举项
     * @param code
     * @return
     */
    public static StartTypeEnum getByCode(String code) {
        if (code == null) {
            return null;
        }

        for (StartTypeEnum le : StartTypeEnum.values()) {
            if (le.getCode().equals(code.toUpperCase())) {
                return le;
            }
        }

        return null;
    }
    /**
     * 通过代码获取枚举项
     * @param insCode
     * @return
     */
    public static StartTypeEnum getByInsCode(String insCode) {
        if (insCode == null) {
            return null;
        }

        for (StartTypeEnum le : StartTypeEnum.values()) {
            if (le.getInsCode().equals(insCode)) {
                return le;
            }
        }

        return null;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public String getInsCode() {
        return insCode;
    }

}
